package com.jiazhong.集合类.Map;

import java.util.*;

public class HashMapDemo1 {
    public static void main(String[] args) {
        Map<String,String > map=new HashMap<String ,String>(){
            {
                put("key1","val1");
                put("key2","val2");
                put("key3","val3");
                put("key4","val4");
                put("key5","val5");
            }
        };

        Set<String> keySet = map.keySet();
        Iterator<String> iterator = keySet.iterator();
        while (iterator.hasNext()){
            String key = iterator.next();
            String value = map.get(key);
            System.out.println(key+":"+value);
        }


        Collection<String> value = map.values();
        for (String val:value
             ) {
            System.out.println(val);
        }

        System.out.println("===========================");
        for(Map.Entry<String,String> entry: map.entrySet()){
            System.out.println(entry.getKey()+"==="+entry.getValue());
        }
    }
}
